﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace day1
{
    internal class Program
    {
        static void Main(string[] args)
        {
            double a, b, c, p, h, area;
            Console.Write("请输入三角形的边A: ");
            string s = Console.ReadLine();
            a = double.Parse(s);
            Console.Write("请输入三角形的边B: ");
            s = Console.ReadLine();
            b = double.Parse(s);
            Console.Write("请输入三角形的边C: ");
            s = Console.ReadLine();
            c = double.Parse(s);

            if (a > 0 && b > 0 && c > 0 && a + b > c && a + c > b && b + c > a)
            {
                Console.WriteLine("三角形的边长分别为: " +
                    "a = {0},b = {1},c = {2}", a, b, c);
                p = a + b + c;
                h = p / 2;
                area = Math.Sqrt(h * (h - a) * (h - b) * (h - c));
                Console.WriteLine("三角形的周长= {0},面积={1}", p, area);

            }
            else Console.WriteLine("无法构成三角形!");
            Console.ReadKey();

        }

    }
}